package cn.zucc.edu.bruce.iot.receiver;


import cn.zucc.edu.bruce.iot.DataDeal;

public class ReceiveInfraredData extends ReceiveSensorData {
    private boolean open;

    public ReceiveInfraredData(byte[] bytes) {
        setSensorNumber(2);
        this.open = DataDeal.bytesToInt(bytes, 0) == 1;
    }

    @Override
    public String toString() {
        return super.toString() + " Infrared: " + (this.isOpen() ? "opened" : "closed");
    }

    public boolean isOpen() {
        return open;
    }
}
